
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">

    <div class="modal-header">
        <h4 class="modal-title" id="myCurrentStateLabel" jhiTranslate="gbSubjectApp.currentState.home.createOrEditLabel">Create or edit a Current State</h4>
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
                (click)="clear()">&times;</button>
    </div>
    <div class="modal-body">
        <jhi-alert-error></jhi-alert-error>
        <div class="form-group" [hidden]="!currentState.id">
            <label for="id" jhiTranslate="global.field.id">ID</label>
            <input type="text" class="form-control" id="id" name="id"
                   [(ngModel)]="currentState.id" readonly />
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.currentState.subject" for="field_subject">Subject</label>
            <select class="form-control" id="field_subject" name="subject" [(ngModel)]="currentState.subjectId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="subjectOption.id" *ngFor="let subjectOption of subjects; trackBy: trackSubjectById">{{subjectOption.name}}</option>
            </select>
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.currentState.indicator" for="field_indicator">Indicator</label>
            <select class="form-control" id="field_indicator" name="indicator" [(ngModel)]="currentState.indicatorId" >
                <option [ngValue]="null"></option>
                <option [ngValue]="indicatorOption.id" *ngFor="let indicatorOption of indicators; trackBy: trackIndicatorById">{{indicatorOption.name}}</option>
            </select>
        </div>

        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.currentState.value" for="field_value">Value</label>
            <input type="number" class="form-control" name="value" id="field_value" onblur="caculate()" value="1"
                [(ngModel)]="currentState.value" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.currentState.referenceValue" for="field_referenceValue">Reference Value</label>
            <input type="number" class="form-control" name="referenceValue" id="field_referenceValue" onblur="caculate()"  value="1"
                [(ngModel)]="currentState.referenceValue" />
        </div>
        <div class="form-group">
            <label class="form-control-label" jhiTranslate="gbSubjectApp.currentState.deviation" for="field_deviation">Deviation</label>
            <input type="number" class="form-control" name="deviation" id="field_deviation"
                [(ngModel)]="currentState.deviation"  readonly/>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
            <span class="fa fa-ban"></span>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
        </button>
        <button type="submit" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary" >
            <span class="fa fa-save"></span>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
        </button>
    </div>
</form>
